<?php
/**
 * Created by PhpStorm.
 * User: xiaofeng
 * motto: 现在的努力是为了小时候吹过的牛逼！
 * Date: 2020/9/17
 * Time: 23:18
 */
namespace app\admin\controller;
use app\common\business\SpecsValue as SpecsValueBis;
class SpecsValue extends AdminBase{

    public function save(){
        $specsId = input("param.specs_id",0,"intval");
        $name = input("param.name","","trim");

        $data = [
            "specs_id"=>$specsId,
            "name"=>$name
        ];
        $id = (new SpecsValueBis())->add($data);

        if (!$id){
            return show(config("status.error"),"新增失败");
        }
        return show(config("status.success"),"OK",["id"=>$id]);
    }

    public function getBySpecsId(){
        $specsId = input("param.specs_id",0,"intval");
        if (!$specsId){
            return show(config("status.success"),"没有数据");
        }
        $result = (new SpecsValueBis())->getBySpecsId($specsId);
        return show(config("status.success"),"OK",$result);
    }
}
